<div class="modal-header">
  <ng-container>
    <div class="modal-title">{{record.id ? '编辑' : '新建' }}</div>
  </ng-container>
</div>
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>

<div *ngIf="i">
  <form nz-form [formGroup]="validateForm">
    <input nz-input hidden formControlName="id"/>
    <div nz-row [nzGutter]="24">

      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSpan]="8" nzFor="model" nzRequired>适用模型</nz-form-label>
          <nz-form-control [nzSpan]="16" nzErrorTip="适用模型必填！">
            <input nz-input formControlName="model" id="model" placeholder="适用模型"/>
          </nz-form-control>
        </nz-form-item>
      </div>

      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSm]="8" [nzXs]="24" nzRequired nzFor="name">名称</nz-form-label>
          <nz-form-control [nzSm]="16" [nzXs]="24" nzHasFeedback nzErrorTip="名称必填！">
            <input nz-input formControlName="name" id="name" placeholder="名称"/>
          </nz-form-control>
        </nz-form-item>
      </div>

      <div nz-col [nzSpan]="20">
        <nz-form-item>
          <nz-form-label [nzSpan]="8" nzFor="description">描述</nz-form-label>
          <nz-form-control [nzSpan]="16">
          <textarea nz-input [rows]="3" placeholder="权限描述" formControlName="description"
                    id="description"></textarea>
          </nz-form-control>
        </nz-form-item>
      </div>
    </div>
  </form>
</div>

<div class="modal-footer">
  <button nz-button type="button" (click)="close()">关闭</button>
  <button nz-button type="submit" nzType="primary" (click)="submitForm(validateForm.value)"
          [disabled]="!validateForm.valid" [nzLoading]="http.loading">保存
  </button>
</div>
